﻿@using myTutor.Models
@model UserMaster

@{
    ViewBag.Title = "Chỉnh sửa thông tin cơ bản";
    
    string imagePath = string.IsNullOrEmpty(Model.UserProfile.ImageFileName) ? (Model.UserProfile.Gender == "2" ? Config.GetDefaultProfileImageFemale() : Config.GetDefaultProfileImageMale()) : Model.UserProfile.ImageFileName;
    object isMale = Model.UserProfile.Gender == "1" ? (new { Checked = "checked" }) : null;
    object isFemale = Model.UserProfile.Gender == "2" ? (new { Checked = "checked" }) : null;
}

<style type="text/css">
    .divchild
    {
        padding-right:5px;
        width:120px;
        float:left;
        margin-left:25px;
        margin-bottom:8px;
    }

    .divbasicpro
    {
        font-size:12px;
        font-weight:lighter;
        margin-top:5px;
    }
    .divotherinfo
    {
        font-size:16px;
        font-weight:lighter;
        margin-top:5px;
        margin-left:80px
    }
</style>

<span style="float:right;">@Html.ActionLink("Trình độ học vấn", "Education", "Account") | @Html.ActionLink("Kinh nghiệm làm việc", "Experiences", "Account")</span>
<h2>Chỉnh sửa thông tin cá nhân</h2>
@using (Html.BeginForm("BasicInfo", "Account", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true, "Lưu trữ không thành công. Vui lòng kiểm tra lại!")
    <div style="float:left; padding-left:150px; padding-bottom:20px;">
        <div style="height:222px;">
            <div style="float:left;margin-left:10px;" align="center">            
                <img src="~/Files/Profiles/@imagePath" alt="" height="200" width="150px"/>
            </div>
            <div style="float:left;margin-top:20px;margin-left:20px">
             <div style="clear:both" align="right" class ="divchild">Họ tên (Bắt buộc): </div> 
                <div style="float: left;">@Html.TextBoxFor(m => m.CustomLastName, new { style = "width:134px;" })@Html.TextBoxFor(m => m.CustomFirstName, new { style = "width:60px;" })<br />@Html.ValidationMessageFor(m => m.CustomLastName) @Html.ValidationMessageFor(m => m.CustomFirstName)</div>
                <div style="clear:both" align="right" class ="divchild">Trường/Đơn vị: </div>
                <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.University)</div>
                <div style="clear:both" align="right" class ="divchild">Ngày sinh: </div>
                <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.CustomDOB, new { id = "dob" })</div>
                <div style="clear:both" align="right" class ="divchild">Giới tính: </div>
                <div style="float: left;">
                    @Html.RadioButtonFor(m => m.UserProfile.Gender, "1", isMale)Nam 
                    @Html.RadioButtonFor(m => m.UserProfile.Gender, "2", isFemale)Nữ                 
                </div>
                <div style="clear:both;">Ảnh đại diện (150x200px): 
                    @Html.TextBoxFor(m => m.CustomImageFileName, new { type = "file"})
                    @Html.HiddenFor(m => m.UserProfile.ImageFileName)
                    @Html.HiddenFor(m => m.UserName)
                </div>
            </div>
            <div style="clear:both"></div>
            <hr />
            </div>
            <div style="margin-top:20px;margin-left:15px;clear:both;">
                <div style="color:Black ;font-weight:bold;font-size:16px;margin-bottom:10px"> Thông tin giới thiệu </div>
                <div class ="divchild" >@Html.TextAreaFor(m => m.UserProfile.AboutMe, new { style = "max-height:100px;max-width:500px;width:500px", maxlength = "256" })</div>
            </div>
            <div style="margin-left:15px;clear:both">
                <div style="color:Black ;font-weight:bold;font-size:16px;margin-bottom:10px">Thông tin liên lạc </div>
                <div style="clear:both"></div>
                <div>
                    <div style="clear:both" align="right" class ="divchild">Email: </div> 
                    <div style="float: left;">@Html.DisplayFor(m => m.Email)</div>
                    <div style="clear:both" align="right" class ="divchild">Facebook: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.FacebookPage, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Google+: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.GooglePlusPage, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Website/Blog: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.Website, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Điện thoại di động: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.MobiPhone, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Số nhà: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.HouseNumber, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Đường: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.Street, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Phường: </div>
                    <div style="float: left;">@Html.TextBoxFor(m => m.UserProfile.Ward, new { style = "width:350px;" })</div>
                    <div style="clear:both" align="right" class ="divchild">Tỉnh/Thành phố: </div>
                    <div style="float: left">
                        @Html.DropDownListFor(m => m.UserProfile.ProvinceId, new SelectList(ProvinceMaster.GetSimpleProvinces(), "Id", "StringValue"), "Chọn Tỉnh/Thành Phố", new { id = "provinces", style = "width:356px" })
                    </div>
                    <div style="clear:both" align="right" class ="divchild">Quận/Huyện: </div>
                    <div style="float: left">
                        @Html.DropDownListFor(m => m.UserProfile.DistrictId, new SelectList(ProvinceMaster.GetSimpleDistricts(Model.UserProfile.ProvinceId.ToString()), "Id", "StringValue", Model.UserProfile.DistrictId), "Chọn Huyện/Quận", new { id = "districts", style = "width:356px" })
                    </div>
                </div>
            </div>
            <div style="margin-left:15%;padding-top:20px; clear:both;">
                <strong><span class="submit-img but-blue"><span class="icon icon-submit"></span><input type="submit" class="but-submit submit-blue" value="Cập nhật thông tin" /></span> 
                <a class="button-img but-orange" href="~/Account/UserProfile"><span class="icon icon-submit"></span><span>Quay lại trang cá nhân</span></a></strong>
            </div>
        </div>
}

@section scripts{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#dob").datepicker();
        }); 
    </script> 
}